package com.huluobo.a2201mvvm_imdemo.mvpdemo;

/**
 * Created by LC on 2024/3/21.
 */
public class LoginPresenter {
    LoginModel loginModel = new LoginModel();
    LoginView loginView;

    public LoginPresenter(LoginView loginView) {
        this.loginView = loginView;
    }

    public void login(String username, String password) {
        UserBean user = loginModel.login(username, password);
        if (user != null) {
            //p层返回成功
            loginView.success(user);
        } else {
            //p层返回失败
            loginView.failed("登录失败");
        }
    }
}
